import Vue from 'vue'
import VueRouter from 'vue-router'
import loginIndex from '@/views/login/loginIndex'
import layoutIndex from '@/layout/layoutIndex'
import dashboard from './modules/dashboard'
import ManageBaseInfo from './modules/ManageBaseInfo'
import ManageBusiness from './modules/ManageBusiness'
import ManageStorage from './modules/ManageStorage'
import ManageStorageIn from './modules/ManageStorageIn'
import ManageStorageOut from './modules/ManageStorageOut'

Vue.use(VueRouter)

const constantRoutes = [
  {
    path: '/',
    name: 'login',
    component: loginIndex
  },
  {
    path: '/layout',
    name: 'layout',
    component: layoutIndex,
    redirect: '/dashboard'
  }
]

const asyncRoutes = [
  dashboard,
  ManageBaseInfo,
  ManageBusiness,
  ManageStorage,
  ManageStorageIn,
  ManageStorageOut
]

const routes = [...constantRoutes, ...asyncRoutes]

const router = new VueRouter({
  routes
})

export default router
